package course_9_2.eg;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Exc2 {
    public static void main(String[] args) {
        int i=0;
        while (true){
            try {
                int[] a = {1, 2, 3, 4};
                i=new Scanner(System.in).nextInt();
                System.out.println(a[i]);
            } catch (ArrayIndexOutOfBoundsException arrayIndexOutOfBoundsException) {
                System.out.println(arrayIndexOutOfBoundsException);
            }catch (Exception e){
                System.out.println(e.getMessage());
                continue;
            }finally {
                System.out.println("finally");
            }
            System.out.println("out of try");
            if(i==0)break;
        }
    }
}
